package com.google.code.virtualhockey.vhx.sds.fields

import java.util.Date
import com.google.appengine.api.datastore.Key
import com.google.code.virtualhockey.vhx.sds._

/**
 * Represents a date/time.
 */
class SKeyField( parent: STMetaData[_],
                 name: String,
                 dbName: Option[String] = None ) extends SField( parent, name, true, dbName ) {

  protected type TRawType = SKey[_]
  protected type TGaeType = Key
  protected val _clsRaw = classOf[TRawType]
  protected val _clsGae = classOf[TGaeType]

  override protected[sds] def convertGaeToSds( value: TGaeType ): TRawType = {
    SKey.fromGaeKey( value )
  }

  override protected[sds] def convertSdsToGae( value: TRawType ): TGaeType = {
    value.toGaeKey
  }
}
